<?php

include 'common.php';

/**
 * 这是一个发放的的例子
 */
class TransferRequest
{
    public $name;
    public $accountType;
    public $accountNo;
    public $idCardNo;
    public $outBizNo;
    public $transAmount;
    public $phone;
    public $notifyUrl;
    public $remark;
}


$req = new TransferRequest();
$req->transAmount = "0.1";
$req->phone = "13800138000";
$req->accountType = "WX_ACCOUNT";
$req->accountNo = "621488190000000001";
$req->idCardNo = "32048119940308281X";
$req->outBizNo = 'ORD1232343';
$req->name = "张三";
$req->notifyUrl = "http://wz.baiyiadsense.com/payment/kylin/transfer";
$req->remark = "备注";

$json = json_encode($req, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);

$publicReq = new publicRequesrt();
$publicReq->bizContent = $json;
$publicReq->charset = "utf-8";
$publicReq->companyId = "1047";
$publicReq->signType = "RSA2";
$publicReq->timestamp = date('Y-m-d H:i:s', time());


$publicReqSign = "bizContent=$json&charset=$publicReq->charset&companyId=$publicReq->companyId&signType=$publicReq->signType&timestamp=$publicReq->timestamp";

$rsa2 = RsaSign($publicReqSign);

$publicReq->sign = $rsa2;

$publicReqBody = json_encode($publicReq, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);


echo "请求报文: $publicReqBody \r\n";

http_post("https://api.kylin-task.com/api/kycloud/open/v1.0/transfer", $publicReqBody);
